/**
 * @Author : lily80239464
 * @Timestamp : 2017-11-09
 */
var do_Notification = sm("do_Notification");
var do_Global = sm("do_Global");
var do_App = sm("do_App");
var do_Page = sm("do_Page");
var do_DataCache = sm("do_DataCache");
var do_ALayout_b0 = ui("do_ALayout_b0");
var do_ALayout_b1 = ui("do_ALayout_b1");
var do_ALayout_b2 = ui("do_ALayout_b2");
var do_ImageView_b0 = ui("do_ImageView_b0");
var do_ImageView_b1 = ui("do_ImageView_b1");
var do_ImageView_b2 = ui("do_ImageView_b2");
var do_ViewShower_main = ui("do_ViewShower_main");
//定义每个按钮的touch事件
do_ALayout_b0.on("touch",function(data, e) {
	do_ImageView_b0.source="source://image/msg_icon_press.png";
	do_ImageView_b1.source="source://image/order_icon_default.png";
	do_ImageView_b2.source="source://image/personal_icon_default.png";
	do_ViewShower_main.show("message");
});
do_ALayout_b1.on("touch", function(data, e) {
	do_ImageView_b0.source="source://image/msg_icon_default.png";
	do_ImageView_b1.source="source://image/order_icon_press.png";
	do_ImageView_b2.source="source://image/personal_icon_default.png";
	do_ViewShower_main.show("main");
});
do_ALayout_b2.on("touch",function(data, e) {
	do_ImageView_b0.source = "source://image/msg_icon_default.png";
	do_ImageView_b1.source="source://image/order_icon_default.png";
	do_ImageView_b2.source="source://image/personal_icon_press.png";
	do_ViewShower_main.show("mine");
});
//当前页面下，订阅android系统返回键的事件；
var delayTime = mm("do_Timer");
var canBack = false;
delayTime.delay = 2000;
delayTime.on("tick", function(data, e) {
	delayTime.stop();
	canBack = false;
});
do_Page.on("back", function(data, e) {
	if (canBack) {
		do_App.closePage();
	}else {
		do_Notification.toast("再次点击退出应用");
		canBack = true;
		delayTime.start();
	}
});
//绑定viewshower的3个子页面
var viewShower_data = [{
	"id":"msg",
	"path":"source://view/message/mseeage.ui"
},{
	"id":"main",
	"path":"source://view/main/main.ui"
},{
	"id":"mine",
	"path":"source://view/mine/mine.ui"
}];
do_ViewShower_main.addViews(viewShower_data);
do_ViewShower_main.showView("main");


